'use strict';

let debug = require('debug')('category');
let mongoDao = new require('./mongo/Category.js')();

let DaoDispatcher = function () {
};
module.exports = new DaoDispatcher();

let theProto = DaoDispatcher.prototype;

/**
 * 添加单个entity add single district
 * @param json
 * @returns {*}
 */
theProto.addOne = function*(inParams) {
    let result = yield mongoDao.saveOne(inParams);
    return result;
};

theProto.findById = function*(id) {
    return "TODO";
};

/**
 * add many
 */
theProto.addBatch = function *(inParams) {
    let result = yield mongoDao.saveMany(inParams);
    return result;
};

/**
 * 检测是否存在某个 category
 * @param cates
 */
theProto.exists = function*(cates) {
    let result = yield mongoDao.exists(cates);
    return result;
};
